]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
main: Show a warning when running as root
authorMatthias Clasen <mclasen@redhat.com>
Sat, 8 Jun 2013 17:32:35 +0000 (13:32 -0400)
committerFlorian Müllner <florian.muellner@gmail.com>
Sat, 12 Oct 2019 20:36:38 +0000 (20:36 +0000)
gnome-session used to show a dialog in this case, but a
notification is more natural nowadays. Doing it in gnome-shell
avoids complicated synchronization between gnome-session and
gnome-shell.

https://bugzilla.gnome.org/show_bug.cgi?id=701212

js/ui/main.js

index 17f5bc716db3a6b4e790cba9c219d93262e76783..d8b0b9b6a4a3d8fddd8f60f19e9590b3df5404e1 100644 (file)
@@ -262,6 +262,12 @@ function _initializeUI() {
             });
         }
 
+        let credentials = new Gio.Credentials();
+        if (credentials.get_unix_user() === 0) {
+            notify(_('Logged in as a privileged user'),
+                   _('Running a session as a privileged user should be avoided for security reasons. If possible, you should log in as a normal user.'));
+        }
+
         LoginManager.registerSessionWithGDM();
 
         let perfModuleName = GLib.getenv("SHELL_PERF_MODULE");